package com.pine.manager.pineframework.convertors;

import com.pine.common.beans.pineframework.request.SysRoleMenuQueryRequest;
import com.pine.common.beans.pineframework.response.SysRoleMenuQueryResponse;
import com.pine.common.convertor.EntityConvertor;
import com.pine.common.convertor.QueryConvertor;
import com.pine.dao.pineframework.entity.SysRoleMenu;
import com.pine.manager.pineframework.bo.SysRoleMenuBo;
import com.pine.manager.pineframework.query.SysRoleMenuQuery;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * <p>
 * 角色菜单表 转换器
 * </p>
 *
 * @author pine manage
 * @since 2024-08-12
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class SysRoleMenuConvertor implements EntityConvertor<SysRoleMenu, SysRoleMenuBo>,
        QueryConvertor<SysRoleMenuBo, SysRoleMenuQuery, SysRoleMenuQueryRequest, SysRoleMenuQueryResponse> {

    @Override
    public abstract SysRoleMenu entityBoToEntity(SysRoleMenuBo sysRoleMenuBo);

    @Override
    public abstract SysRoleMenuBo entityToEntityBo(SysRoleMenu sysRoleMenu);

    @Override
    public abstract SysRoleMenuQueryResponse entityBoToQueryResponse(SysRoleMenuBo sysRoleMenuBo);

    @Override
    public abstract SysRoleMenuQuery queryRequestToQuery(SysRoleMenuQueryRequest queryRequest);

    @Override
    public abstract List<SysRoleMenu> entityBoToEntity(List<SysRoleMenuBo> entityBo);

    @Override
    public abstract List<SysRoleMenuBo> entityToEntityBo(List<SysRoleMenu> entity);


    @AfterMapping
    public void afterMappingEntityBoToEntity(@MappingTarget SysRoleMenu sysRoleMenu, SysRoleMenuBo sysRoleMenuBo) {
        // entityBoToEntity() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToEntity()
    }

    @AfterMapping
    public void afterMappingEntityToEntityBo(@MappingTarget SysRoleMenuBo sysRoleMenuBo, SysRoleMenu sysRoleMenu) {
        // entityToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityToEntityBo()
    }

    @AfterMapping
    public void afterMappingQueryRequestToQuery(@MappingTarget SysRoleMenuQuery sysRoleMenuQuery, SysRoleMenuQueryRequest sysRoleMenuQueryRequest) {
        // queryRequestToQuery() 内部其它代码执行完之后，最后会自动执行 afterMappingQueryRequestToQuery()
    }

    @AfterMapping
    public void afterMappingEntityBoToQueryResponse(@MappingTarget SysRoleMenuQueryResponse sysRoleMenuQueryResponse, SysRoleMenuBo sysRoleMenuBo) {
        // entityBoToQueryResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToQueryResponse()
    }

}
